//
//  WHYAdViewController.m
//  News163
//
//  Created by 王洪运 on 15/12/29.
//  Copyright © 2015年 王洪运. All rights reserved.
//

#import "WHYAdViewController.h"
#import "UIImageView+WHYExtension.h"
#import "Masonry.h"
#import "WHYTabBarViewController.h"

@interface WHYAdViewController ()
//背景图
@property (strong, nonatomic) UIImageView *backgroundImageView;
//广告图
@property (strong, nonatomic) UIImageView *adImageView;

@end

@implementation WHYAdViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    
    [self.backgroundImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.mas_equalTo(self.view);
    }];
    
    [self.adImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(306, 310));
        make.centerX.mas_equalTo(self.view);
        make.centerY.mas_equalTo(self.view.mas_centerY).multipliedBy(0.8);
    }];
    
//   切换到主控制器
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        
        UIWindow *window = [UIApplication sharedApplication].keyWindow;
        
        window.rootViewController = [[WHYTabBarViewController alloc] init];
        
    });
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];

    
}

#pragma mark - 懒加载子控件
-(UIImageView *)adImageView {
    if (_adImageView == nil) {
        _adImageView = [UIImageView imagwViewWithImageName:@"ad"];
        [self.view addSubview:_adImageView];
    }
    return _adImageView;
}

-(UIImageView *)backgroundImageView {
    
    if (_backgroundImageView == nil) {
        _backgroundImageView = [UIImageView imagwViewWithImageName:@"Default"];
        [self.view addSubview:_backgroundImageView];
    }
    return _backgroundImageView;
    
}



@end
